package top.mayyd.productfeignconsumer.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.mayyd.producteurekaservice.domain.Product;
import top.mayyd.productfeignconsumer.client.ProductClient;

@RestController
@RequestMapping("consumer/product")
public class ProductController {

    @Autowired
    private ProductClient productClient;

    @GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
    public Product show(@PathVariable("id") Long id) {
        Product product = productClient.queryById(id);
        System.out.println(product);
        return product;
    }
}
